/* GUI CONVERTED from rssdtmt.p (converter v1.75) Sat Aug 12 23:16:24 2000 */
/* rssdtmt.p - Supplier Shipping Schedule Standard Delivery Time Maint     */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                     */
/* All rights reserved worldwide.  This is an unpublished work.            */
/*V8:ConvertMode=Maintenance                                               */
/*V8:RunMode=Character,Windows                                             */
/* REVISION: 9.0      CREATED:       07/13/98   By: *K1QZ* Pat McCormick   */
/* REVISION: 9.0     MODIFIED:       03/13/99   By: *M0BD* Alfred Tan      */
/* REVISION: 9.1      LAST MODIFIED: 03/24/00 BY: *N08T* Annasaheb Rahane */
/* REVISION: 9.1      LAST MODIFIED: 08/12/00 BY: *N0KP* myb               */
/*                                                                          */
/* -----  W A R N I N G  -----  W A R N I N G  -----  W A R N I N G  -----  */
/*                                                                          */
/*         THIS PROGRAM IS A BOLT-ON TO STANDARD PRODUCT MFG/PRO.           */
/* ANY CHANGES TO THIS PROGRAM MUST BE PLACED ON A SEPARATE ECO THAN        */
/* STANDARD PRODUCT CHANGES.  FAILURE TO DO THIS CAUSES THE BOLT-ON CODE TO */
/* BE COMBINED WITH STANDARD PRODUCT AND RESULTS IN PATCH DELIVERY FAILURES.*/
/*                                                                          */
/* -----  W A R N I N G  -----  W A R N I N G  -----  W A R N I N G  -----  */
/*                                                                          */

        /* DISPLAY TITLE */
        {mfdtitle.i "b+ "}

/* **************** Begin Translatable Strings Definitions **************** */

/* ***************** End Translatable Strings Definitions ***************** */

        define variable l_del_yn      like mfc_logical initial no no-undo.
        define variable l_sdt_recno as recid no-undo.

        /* DISPLAY SELECTION FORM */
        
/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 
        
 RECT-FRAME       AT ROW 1 COLUMN 1.25
 RECT-FRAME-LABEL AT ROW 1 COLUMN 3 NO-LABEL VIEW-AS TEXT SIZE-PIXELS 1 BY 1
 SKIP(.1)  /*GUI*/
sdt_code            colon 30 skip(1)
        sdt_desc            colon 30
         SKIP(.4)  /*GUI*/
with frame a side-labels width 80  attr-space NO-BOX THREE-D /*GUI*/.

 DEFINE VARIABLE F-a-title AS CHARACTER INITIAL "".
 RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
 RECT-FRAME-LABEL:HIDDEN in frame a = yes.
 RECT-FRAME:HEIGHT-PIXELS in frame a =
  FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.
 RECT-FRAME:WIDTH-CHARS IN FRAME a = FRAME a:WIDTH-CHARS - .5.  /*GUI*/

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME



        /* SET EXTERNAL LABELS */
        setFrameLabels(frame a:handle).

        view frame a.
        mainloop:
        repeat:
/*GUI*/ if global-beam-me-up then undo, leave.


            loopa:
            do transaction with frame a:
/*GUI*/ if global-beam-me-up then undo, leave.

                prompt-for sdt_code with frame a editing:
                    /* FIND NEXT/PREVIOUS RECORD */
                    {mfnp.i sdt_mstr sdt_code sdt_code
                    sdt_code sdt_code sdt_code}
                    if recno <> ? then
                        display
                            sdt_code
                            sdt_desc.
                    assign l_sdt_recno = recid(sdt_mstr).
                end. /* END OF EDITING LOOP */

                if input sdt_code = "" then
                do:
                    /* BLANK NOT ALLOWED */
                    {mfmsg.i 40 3}
                    undo, retry.
                end. /* END OF IF sdt_code = "" */

                /* ADD/MOD/DELETE  */
                find sdt_mstr using sdt_code exclusive-lock no-error.
                if not available sdt_mstr then do:
                    {mfmsg.i 1 1}    /* ADDING NEW RECORD */
                    create sdt_mstr.
                    assign
                        sdt_code
                        sdt_mod_userid = global_userid
                        sdt_mod_date = today.
                    if recid(sdt_mstr) = -1 then .

                end. /* END OF IF NOT AVAILABLE sdt_mstr */
                l_sdt_recno = recid(sdt_mstr).
                display
                   sdt_code
                   sdt_desc
                with frame a.

                ststatus = stline[2].
                status input ststatus.

                l_del_yn = no.
                seta: do on error undo, retry:
/*GUI*/ if global-beam-me-up then undo, leave.

                   set sdt_desc
                   go-on("F5" "CTRL-D") with frame a.

                   if lastkey = keycode("F5") or lastkey = keycode("CTRL-D")
                   then do:

                        for first pod_det where pod__qad07 = input sdt_code:
                        end.

                        if available pod_det then do:
                         {mfmsg.i 2556 4} /*RECORD IN USE, CANNOT DELETE */
                         undo, retry.
                        end. /* if available pod_det */

                      {mfmsg01.i 11 1 l_del_yn} /* CONFIRM DELETE */
                      if not l_del_yn then undo seta.
                   end.
/*GUI*/ if global-beam-me-up then undo, leave.


                   /* DELETE RECORD */
                   if l_del_yn then do:

                     for each sdtd_det where sdtd_code = sdt_code exclusive-lock:
                         delete sdtd_det.
                     end. /* for each */
                     delete sdt_mstr.

                      clear frame a.
/*GUI*/ RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
                      next mainloop.
                   end.

                   assign
                       sdt_desc.
                end.
/*GUI*/ if global-beam-me-up then undo, leave.
  /* SETA */
            end.
/*GUI*/ if global-beam-me-up then undo, leave.
  /* END OF LOOPA */
            {gprun.i ""rssdtmta.p"" "(input l_sdt_recno)"}
/*GUI*/ if global-beam-me-up then undo, leave.


        end.  /* MAINLOOP */
